#include "Iterator.h"
#include "Aggregate.h"

using namespace std;

Iterator::Iterator(){
}

Iterator::~Iterator(){
}

ConcreteIterator::ConcreteIterator(){
}

ConcreteIterator::ConcreteIterator(ConcreteAggregate* aggregate){
	_aggregate = aggregate;
	_current = 0;
}

ConcreteIterator::~ConcreteIterator(){
}

string ConcreteIterator::First(){
	return _aggregate->GetItem(0);
}

string ConcreteIterator::Next(){
	string ret = "";
	_current++;
	if (_current < _aggregate->Count())
	{
		ret = _aggregate->GetItem(_current);
	}
	return ret;
}

bool ConcreteIterator::IsDone(){
	return _current >= _aggregate->Count() ? true : false;
}

string ConcreteIterator::CurrentItem(){
	return _aggregate->GetItem(_current);
}